﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package org.aswing.util {
    import flash.utils.*;

    public class HashMap {

        private var length:int;
        private var content:Dictionary;

        public function HashMap(){
            this.length = 0;
            this.content = new Dictionary();
        }
        public function size():int{
            return (this.length);
        }
        public function isEmpty():Boolean{
            return ((this.length == 0));
        }
        public function keys():Array{
            var _local3:*;
            var _local1:Array = new Array(this.length);
            var _local2:int;
            for (_local3 in this.content) {
                _local1[_local2] = _local3;
                _local2++;
            };
            return (_local1);
        }
        public function eachKey(_arg1:Function):void{
            var _local2:*;
            for (_local2 in this.content) {
                _arg1(_local2);
            };
        }
        public function eachValue(_arg1:Function):void{
            var _local2:*;
            for each (_local2 in this.content) {
                _arg1(_local2);
            };
        }
        public function values():Array{
            var _local3:*;
            var _local1:Array = new Array(this.length);
            var _local2:int;
            for each (_local3 in this.content) {
                _local1[_local2] = _local3;
                _local2++;
            };
            return (_local1);
        }
        public function containsValue(_arg1):Boolean{
            var _local2:*;
            for each (_local2 in this.content) {
                if (_local2 === _arg1){
                    return (true);
                };
            };
            return (false);
        }
        public function containsKey(_arg1):Boolean{
            if (this.content[_arg1] != undefined){
                return (true);
            };
            return (false);
        }
        public function get(_arg1){
            var _local2:* = this.content[_arg1];
            if (_local2 !== undefined){
                return (_local2);
            };
            return (null);
        }
        public function getValue(_arg1){
            return (this.get(_arg1));
        }
        public function put(_arg1, _arg2){
            var _local3:Boolean;
            var _local4:*;
            if (_arg1 == null){
                throw (new ArgumentError("cannot put a value with undefined or null key!"));
            };
            if (_arg2 == null){
                return (this.remove(_arg1));
            };
            _local3 = this.containsKey(_arg1);
            if (!_local3){
                this.length++;
            };
            _local4 = this.get(_arg1);
            this.content[_arg1] = _arg2;
            return (_local4);
        }
        public function remove(_arg1){
            var _local2:Boolean = this.containsKey(_arg1);
            if (!_local2){
                return (null);
            };
            var _local3:* = this.content[_arg1];
            delete this.content[_arg1];
            this.length--;
            return (_local3);
        }
        public function clear():void{
            this.length = 0;
            this.content = new Dictionary();
        }
        public function clone():HashMap{
            var _local2:*;
            var _local1:HashMap = new HashMap();
            for (_local2 in this.content) {
                _local1.put(_local2, this.content[_local2]);
            };
            return (_local1);
        }
        public function toString():String{
            var _local1:Array = this.keys();
            var _local2:Array = this.values();
            var _local3 = "HashMap Content:\n";
            var _local4:int;
            while (_local4 < _local1.length) {
                _local3 = (_local3 + (((_local1[_local4] + " -> ") + _local2[_local4]) + "\n"));
                _local4++;
            };
            return (_local3);
        }

    }
}//package org.aswing.util 
